$(function(){
    // 加载更多内容
    $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if ((scrollTop + windowHeight) == (scrollHeight)) {
        	//loadData();
        }
    });
})

var current=1;
var finish=false;
function loadData(type){//加载更多按钮
	if(finish){
		return ;
	}
	$(".load-more").show();
	$(".load-more-two").hide();
	$(".no-data").hide();
	
	current++;

	var data={};
	data["indexPage"] = current;
	data["type"] = type;
	$.ajax({
		type: "POST",
		url: basePath + "index/append",
		data: data,
		success: function (data) {
			$(".load-more").hide();
			//如果没有数据了就隐藏
			if(data.length==0){
				finish=true;
				$(".no-data").show();
			}else{
				$(".load-more-two").show();
				$("#myContent").append(data);
			}
		}
	});



}
//点击推荐，热门，推荐
function clickType(obj,val){
	type=val;
	current=0;
	finish=false;
	$("#myContentList").html("");
	$(".main-tab-ul li").removeClass("main-tab-active");
    $(obj).addClass("main-tab-active");
    loadData();
}
